﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataObject;
using DataContext;
using Entity;
using HR_Interface;

namespace HR_Implement
{
    public class EmployeeRemotingObject: MarshalByRefObject,IEmployee
    {
        HRDatabaseDataContext ctx = new HRDatabaseDataContext();
        public List<DataObject.EmployeeEntity> getAllEmployee()
        {
            var q = from p in ctx.Employees
                    select new DataObject.EmployeeEntity()
                    {
                        CEmployeeCode = p.cEmployeeCode,
                        VFirstName = p.vFirstName,
                        VLastName = p.vLastName,
                        VQualification = p.vQualification
                    };
            return q.ToList();
        }
        public List<DataObject.EmployeeEntity> searchEmployeeByQualification(String qualification)
        {
            var q = from p in ctx.Employees
                    where p.vQualification.Equals(qualification)
                    select new DataObject.EmployeeEntity(){
                        CEmployeeCode=p.cEmployeeCode ,
                        VFirstName=p.vFirstName,
                        VLastName=p.vLastName,
                        VQualification=p.vQualification                     
                    } ;
            return q.ToList();
        }

    }
}
